package mutsumimod.cards.deprecated;

import basemod.AutoAdd;
import com.badlogic.gdx.graphics.Color;
import com.megacrit.cardcrawl.actions.AbstractGameAction;
import com.megacrit.cardcrawl.actions.animations.VFXAction;
import com.megacrit.cardcrawl.cards.AbstractCard;
import com.megacrit.cardcrawl.cards.red.Feed;
import com.megacrit.cardcrawl.characters.AbstractPlayer;
import com.megacrit.cardcrawl.core.Settings;
import com.megacrit.cardcrawl.monsters.AbstractMonster;
import com.megacrit.cardcrawl.vfx.combat.BiteEffect;
import mutsumimod.actions.deprecated.PerfectStandAction;
import mutsumimod.cards.BaseCard;
import mutsumimod.character.Mutsumi;
import mutsumimod.util.CardStats;

@Deprecated
@AutoAdd.Ignore
public class Eat extends BaseCard  {
    public static final String ID = makeID(Eat.class.getSimpleName());
    public static final CardStats info = new CardStats(
            Mutsumi.Meta.CARD_COLOR,
            CardType.ATTACK,
            CardRarity.RARE,
            CardTarget.ENEMY,
            1
    );

    public Eat() {
        super(ID, info);
        setAttr(10,0,3);
        setAttrUpg(2,0,1);
        cardsToPreview = new Feed();
        setShouldCopyUse(true);
        exhaust = true;
    }

    @Override
    public void beforeCopy(){
        clearCopyCardsAddSelf();
        Feed feed = new Feed();
        if(upgraded) {
            feed.upgrade();
        }
        addCopyCards(feed);
    }

    @Override
    public void use(AbstractPlayer p, AbstractMonster m) {
        addToBot(new VFXAction(new BiteEffect(m.hb.cX, m.hb.cY - 40.0F * Settings.scale, Color.SCARLET.cpy()), 0.3F));
        damageMonster(m, AbstractGameAction.AttackEffect.NONE);
        addToBot(new PerfectStandAction(5, new AbstractGameAction() {
            @Override
            public void update() {
                p.increaseMaxHp(magicNumber, false);
                isDone = true;
            }
        }));
    }

    @Override
    public AbstractCard makeCopy() { //Optional
        return new Eat();
    }

    @Override
    public void updateDescription() {
        if(getInCopyUse()){
            rawDescription = cardStrings.EXTENDED_DESCRIPTION[0];
        }else{
            if(upgraded){
                rawDescription = cardStrings.UPGRADE_DESCRIPTION;
            }else{
                rawDescription = cardStrings.DESCRIPTION;
            }
        }
        initializeDescription();
    }

    @Override
    public void upgrade() {
        if (!upgraded) {
            super.upgrade();
            cardsToPreview.upgrade();
        }
    }

}